<!doctype html>



  


<html class="theme-next mist use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css"/>




  <link href="//fonts.googleapis.com/css?family=Lato:300,400,700,400italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">



<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=0.5.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="git,学习笔记," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=0.5.0" />






<meta name="description" content="git资源
廖雪峰git教程
Git分支管理策略
在线git学习-推荐

我的git 理解Git的作者就是Linux开源OS的作者:Linus Benedict Torvalds),大神就是牛!!!
Git一种版本管理软件,Git管理的是每一次的提交(相当于操作的多出的binary),可以把Git的管理想像成维护一个树结构,每一个结点是就是一个commit,有一个buffer区来存下add操作.">
<meta property="og:type" content="article">
<meta property="og:title" content="git学习笔记">
<meta property="og:url" content="http://yoursite.com/2016/03/git学习笔记/index.html">
<meta property="og:site_name" content="Rainboy">
<meta property="og:description" content="git资源
廖雪峰git教程
Git分支管理策略
在线git学习-推荐

我的git 理解Git的作者就是Linux开源OS的作者:Linus Benedict Torvalds),大神就是牛!!!
Git一种版本管理软件,Git管理的是每一次的提交(相当于操作的多出的binary),可以把Git的管理想像成维护一个树结构,每一个结点是就是一个commit,有一个buffer区来存下add操作.">
<meta property="og:updated_time" content="2016-03-27T15:39:15.232Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="git学习笔记">
<meta name="twitter:description" content="git资源
廖雪峰git教程
Git分支管理策略
在线git学习-推荐

我的git 理解Git的作者就是Linux开源OS的作者:Linus Benedict Torvalds),大神就是牛!!!
Git一种版本管理软件,Git管理的是每一次的提交(相当于操作的多出的binary),可以把Git的管理想像成维护一个树结构,每一个结点是就是一个commit,有一个buffer区来存下add操作.">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Mist',
    sidebar: {"position":"left","display":"hide"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 0,
      author: 'Author'
    }
  };
</script>

  <title> git学习笔记 | Rainboy </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh_Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">Rainboy</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle"></p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-home fa-fw"></i> <br />
            
            Startseite
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-th fa-fw"></i> <br />
            
            Kategorien
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-archive fa-fw"></i> <br />
            
            Archiv
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-tags fa-fw"></i> <br />
            
            Tags
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                git学习笔记
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">Veröffentlicht am</span>
            <time itemprop="dateCreated" datetime="2016-03-27T23:28:20+08:00" content="2016-03-27">
              2016-03-27
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">in</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/学习笔记/" itemprop="url" rel="index">
                    <span itemprop="name">学习笔记</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
              <span class="post-comments-count">
                &nbsp; | &nbsp;
                <a href="/2016/03/git学习笔记/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2016/03/git学习笔记/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          

          
          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="git资源"><a href="#git资源" class="headerlink" title="git资源"></a>git资源</h2><ul>
<li><a href="http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/" target="_blank" rel="external">廖雪峰git教程</a></li>
<li><a href="http://www.ruanyifeng.com/blog/2012/07/git.html" target="_blank" rel="external">Git分支管理策略</a></li>
<li><a href="http://pcottle.github.io/learnGitBranching/" target="_blank" rel="external">在线git学习-推荐</a></li>
</ul>
<h2 id="我的git-理解"><a href="#我的git-理解" class="headerlink" title="我的git 理解"></a>我的git 理解</h2><p>Git的作者就是Linux开源OS的作者:<strong>Linus Benedict Torvalds)</strong>,大神就是牛!!!</p>
<p>Git一种版本管理软件,Git管理的是每一次的提交(相当于操作的多出的binary),可以把Git的管理想像成维护一个树结构,每一个结点是就是一个commit,有一个buffer区来存下add操作.</p>
<p>我们的操作就是在和个结点和结点指针之间移动,commit 增加一个结点并移动相对应的指针,branch 分出一个分支或移动分支指针,checkout 切换分支或移动HEAD指针<br>merge 合并两个branch(当然是从分支指针开始merge),</p>
<h2 id="git命令学习"><a href="#git命令学习" class="headerlink" title="git命令学习"></a>git命令学习</h2><table>
<thead>
<tr>
<th>命令</th>
<th>作用</th>
</tr>
</thead>
<tbody>
<tr>
<td>git commit</td>
<td>提交增量,产生一个新的结点 [1]</td>
</tr>
<tr>
<td>git branch</td>
<td>创建或切换到已有分支</td>
</tr>
<tr>
<td>git merge</td>
<td>合并,会把两不同的结点 并为一个孩子,也就是包含所有修改</td>
</tr>
<tr>
<td>git rebase <dst></dst></td>
<td>取一系列commit点,copy,在别的dst放下,能到列线性的history</td>
</tr>
<tr>
<td>git rebase <src> <dst></dst></src></td>
<td></td>
</tr>
<tr>
<td>HAED</td>
<td>指向当前commit点的指针,最近一次提交记录</td>
</tr>
<tr>
<td>git checkout <dst></dst></td>
<td>移动HEAD 到dst,HEAD^^,HEAD~1</td>
</tr>
<tr>
<td>git branch -f <branch> <dst></dst></branch></td>
<td>强行移到分支到某个点</td>
</tr>
<tr>
<td>HEAD^,HEAD~1,branch^,branch~1</td>
<td>祖先结点</td>
</tr>
<tr>
<td>git reset HEAD^</td>
<td>把当前分支记录退回到某个点</td>
</tr>
<tr>
<td>git revert HEAD</td>
<td>回退,眀会重新生成一个commit</td>
</tr>
<tr>
<td>git cherry-pick <c1> <c2 <c3=""></c2></c1></td>
<td>复制commit到当前HEAD下面</td>
</tr>
<tr>
<td>git rebase -i HEAD~4 –abvoeAll</td>
<td>会有一个UI来手动选择</td>
</tr>
<tr>
<td>git commit –amend</td>
<td>可以使用 git commit –amend 修改上一次的提交信息。</td>
</tr>
<tr>
<td>git tags  <tag> <commit></commit></tag></td>
<td>见下面</td>
</tr>
<tr>
<td>git describe</td>
<td>显示离HEAD最近的tag</td>
</tr>
<tr>
<td>git checkout HEAD^2</td>
<td>多个父亲时,选第二个父亲</td>
</tr>
<tr>
<td>git fetch</td>
<td>下载远程分支</td>
</tr>
<tr>
<td>git pull</td>
<td>下载并merge</td>
</tr>
<tr>
<td>git pull -rebase</td>
<td>将远端的新提交fetch来,本地rebase到o/master上</td>
</tr>
</tbody>
</table>
<p>git cherry-pick origin/master <1> <2> <3> 手动更新orgin/master<br>git rebase origin/master<br>git merge origin/master</3></2></1></p>
<p>remotes track</p>
<ol>
<li>远端分支分出一个branch<br>git checkout -b totallyNotMaster origin/master<br>2.<br>git checkout -u origin/master totallyNotMaster</li>
</ol>
<p>创建并切换到一个新branch new_br<br>git checkout -b <new_br> [src_br]</new_br></p>
<p>Git 手动建立tracking<br>更新现在分支track remote<br>git branch –set-upstreamto=origin/<remote> <local></local></remote></p>
<p>把本地分支 push 到一个新的remote 并track<br>git push -u origin <local>:<remote></remote></local></p>
<p>创建一个运程分支一样名字并track 切换<br>git checkout –track origin/<remote></remote></p>
<p>git reset –hard HEAD^</p>
<p>git push 参数<br>git push <remote> <place><br>git push origin <src>:<dst><br>如果<dst>不存在,那就会在远程程创建一个new branch,如果<src>为空 会删除远程的分支<br>git push origin <local>:<remote><br>git push orgin <local>:     删除一个本地分支<br>git push orgin :<remote>    删除运程分支</remote></local></remote></local></src></dst></dst></src></place></remote></p>
<p>git fetch</p>
<p>git tag  : 永远指向某个特定的commit,有新的commit里,<br>git checkout <tagname> 到tagname的点<br><a href="http://blog.csdn.net/wangjia55/article/details/8793577" target="_blank" rel="external">http://blog.csdn.net/wangjia55/article/details/8793577</a></tagname></p>
<p>git describe <ref>  ref 是一个位置commit</ref></p>
<p>git revert :回退某次提交,并重新提交,相当于代码恢复修改前,也就说revert也是一个commit,只是比较特殊,会修改某些操作<br>git reset :回退到某次提交,同时回退修改log,但是修改内容回退到本地local buffer,由用户确定是不是checkout丢弃</p>
<p>gitk<br>gitk –all 用GUI看全部的branch<br>git log<br>git log –pretty=oneline<br>git log –graphic</p>
<h3 id="git-处理冲突"><a href="#git-处理冲突" class="headerlink" title="git 处理冲突"></a>git 处理冲突</h3><h3 id="git-使用原则"><a href="#git-使用原则" class="headerlink" title="git 使用原则"></a>git 使用原则</h3><ul>
<li>多多commit</li>
<li>不要commit half work</li>
<li>主分支 master 只进行 push 和 fetch ,pull 操作,本地有一个dev分支</li>
<li>git 分支管理策略 <a href="http://www.ruanyifeng.com/blog/2012/07/git.html" target="_blank" rel="external">http://www.ruanyifeng.com/blog/2012/07/git.html</a></li>
</ul>
<p>[1] : 如果我们</p>
<pre><code>git commit -m &quot;3&quot;
git checkout HEAD^
git commit -m &quot;4&quot;
git branch -f master HEAD

上面的操作很有意思
我们强制的HEAD指向上一个结点,然后创建一个新的结点,移动master

没有分支名,也没有HEAD指针的分支,会被删除(也许仅仅是看不到)
因为分支名也是指针,没有指针指向的分支会不见!?
上面说的可能不太对?因使用gitk 和 git log 都看不到,但是使用Git gui 可以看到前三条命令的history!! 难受
</code></pre><h3 id="乱码解决"><a href="#乱码解决" class="headerlink" title="乱码解决"></a>乱码解决</h3><p>在.gitconfig文件中修改或添加如下配置：<br>[core]<br>quotepath = false<br>作用：没有这一条，git status输出中文会显示为UNICODE编码。</p>
<h3 id="git-删除运程文件夹"><a href="#git-删除运程文件夹" class="headerlink" title="git 删除运程文件夹"></a>git 删除运程文件夹</h3><p>git rm -r -n <file><br>-n 只会显示会删除哪些文件,但不会删除</file></p>
<p>git rm -r –cached <file><br>删除远程文件,但不会删除本地</file></p>
<p>在gitignore 上添加 忽略的文件</p>
<h3 id="最后"><a href="#最后" class="headerlink" title="最后"></a>最后</h3><p>本文比较乱,因为git的学习是那种一边查一边的方法,本文会不断完善.</p>

      
    </div>

    <div>
      
        
      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/git/" rel="tag">#git</a>
          
            <a href="/tags/学习笔记/" rel="tag">#学习笔记</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/03/cpp输入输出讲解/" rel="next" title="C++输入输出讲解">
                <i class="fa fa-chevron-left"></i> C++输入输出讲解
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/03/noip学习过程/" rel="prev" title="noip学习过程">
                noip学习过程 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2016/03/git学习笔记/"
           data-title="git学习笔记" data-url="http://yoursite.com/2016/03/git学习笔记/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Inhaltsverzeichnis
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Übersicht
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.jpg"
               alt="Rainboy" />
          <p class="site-author-name" itemprop="name">Rainboy</p>
          <p class="site-description motion-element" itemprop="description">Rainboy Personal Blog by Hexo</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">16</span>
              <span class="site-state-item-name">Artikel</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">10</span>
                <span class="site-state-item-name">Kategorien</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">23</span>
                <span class="site-state-item-name">Tags</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        <div class="links-of-blogroll motion-element">
          
        </div>

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc-indicator-top post-toc-indicator">
            <i class="fa fa-angle-double-up"></i>
          </div>
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#git资源"><span class="nav-number">1.</span> <span class="nav-text">git资源</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#我的git-理解"><span class="nav-number">2.</span> <span class="nav-text">我的git 理解</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#git命令学习"><span class="nav-number">3.</span> <span class="nav-text">git命令学习</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#git-处理冲突"><span class="nav-number">3.1.</span> <span class="nav-text">git 处理冲突</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#git-使用原则"><span class="nav-number">3.2.</span> <span class="nav-text">git 使用原则</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#乱码解决"><span class="nav-number">3.3.</span> <span class="nav-text">乱码解决</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#git-删除运程文件夹"><span class="nav-number">3.4.</span> <span class="nav-text">git 删除运程文件夹</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#最后"><span class="nav-number">3.5.</span> <span class="nav-text">最后</span></a></li></ol></li></ol></div>
            
          </div>
          <div class="post-toc-indicator-bottom post-toc-indicator">
            <i class="fa fa-angle-double-down"></i>
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2016</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Rainboy</span>
</div>

<div class="powered-by">
  Erstellt mit  <a class="theme-link" href="http://hexo.io">Hexo</a>
</div>

<div class="theme-info">
  Theme -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>



      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  


  




<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  <script type="text/javascript" src="/vendors/velocity/velocity.min.js"></script>

  <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js"></script>

  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=0.5.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=0.5.0"></script>



  
  

  
  
<script type="text/javascript" src="/js/src/scrollspy.js?v=0.5.0"></script>

<script type="text/javascript" id="sidebar.toc.highlight">
  $(document).ready(function () {
    var tocSelector = '.post-toc';
    var $tocSelector = $(tocSelector);
    var activeCurrentSelector = '.active-current';

    $tocSelector
      .on('activate.bs.scrollspy', function () {
        var $currentActiveElement = $(tocSelector + ' .active').last();

        removeCurrentActiveClass();
        $currentActiveElement.addClass('active-current');

        $tocSelector[0].scrollTop = $currentActiveElement.position().top;
      })
      .on('clear.bs.scrollspy', function () {
        removeCurrentActiveClass();
      });

    function removeCurrentActiveClass () {
      $(tocSelector + ' ' + activeCurrentSelector)
        .removeClass(activeCurrentSelector.substring(1));
    }

    function processTOC () {
      getTOCMaxHeight();
      toggleTOCOverflowIndicators();
    }

    function getTOCMaxHeight () {
      var height = $('.sidebar').height() -
                   $tocSelector.position().top -
                   $('.post-toc-indicator-bottom').height();

      $tocSelector.css('height', height);

      return height;
    }

    function toggleTOCOverflowIndicators () {
      tocOverflowIndicator(
        '.post-toc-indicator-top',
        $tocSelector.scrollTop() > 0 ? 'show' : 'hide'
      );

      tocOverflowIndicator(
        '.post-toc-indicator-bottom',
        $tocSelector.scrollTop() >= $tocSelector.find('ol').height() - $tocSelector.height() ? 'hide' : 'show'
      )
    }

    $(document).on('sidebar.motion.complete', function () {
      processTOC();
    });

    $('body').scrollspy({ target: tocSelector });
    $(window).on('resize', function () {
      if ( $('.sidebar').hasClass('sidebar-active') ) {
        processTOC();
      }
    });

    onScroll($tocSelector);

    function onScroll (element) {
      element.on('mousewheel DOMMouseScroll', function (event) {
          var oe = event.originalEvent;
          var delta = oe.wheelDelta || -oe.detail;

          this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30;
          event.preventDefault();

          toggleTOCOverflowIndicators();
      });
    }

    function tocOverflowIndicator (indicator, action) {
      var $indicator = $(indicator);
      var opacity = action === 'show' ? 1 : 0;
      $indicator.velocity ?
        $indicator.velocity('stop').velocity({
          opacity: opacity
        }, { duration: 100 }) :
        $indicator.stop().animate({
          opacity: opacity
        }, 100);
    }

  });
</script>

<script type="text/javascript" id="sidebar.nav">
  $(document).ready(function () {
    var html = $('html');
    var TAB_ANIMATE_DURATION = 200;
    var hasVelocity = $.isFunction(html.velocity);

    $('.sidebar-nav li').on('click', function () {
      var item = $(this);
      var activeTabClassName = 'sidebar-nav-active';
      var activePanelClassName = 'sidebar-panel-active';
      if (item.hasClass(activeTabClassName)) {
        return;
      }

      var currentTarget = $('.' + activePanelClassName);
      var target = $('.' + item.data('target'));

      hasVelocity ?
        currentTarget.velocity('transition.slideUpOut', TAB_ANIMATE_DURATION, function () {
          target
            .velocity('stop')
            .velocity('transition.slideDownIn', TAB_ANIMATE_DURATION)
            .addClass(activePanelClassName);
        }) :
        currentTarget.animate({ opacity: 0 }, TAB_ANIMATE_DURATION, function () {
          currentTarget.hide();
          target
            .stop()
            .css({'opacity': 0, 'display': 'block'})
            .animate({ opacity: 1 }, TAB_ANIMATE_DURATION, function () {
              currentTarget.removeClass(activePanelClassName);
              target.addClass(activePanelClassName);
            });
        });

      item.siblings().removeClass(activeTabClassName);
      item.addClass(activeTabClassName);
    });

    $('.post-toc a').on('click', function (e) {
      e.preventDefault();
      var targetSelector = NexT.utils.escapeSelector(this.getAttribute('href'));
      var offset = $(targetSelector).offset().top;
      hasVelocity ?
        html.velocity('stop').velocity('scroll', {
          offset: offset  + 'px',
          mobileHA: false
        }) :
        $('html, body').stop().animate({
          scrollTop: offset
        }, 500);
    });

    // Expand sidebar on post detail page by default, when post has a toc.
    NexT.motion.middleWares.sidebar = function () {
      var $tocContent = $('.post-toc-content');

      if (CONFIG.sidebar.display === 'post' || CONFIG.sidebar.display === 'always') {
        if ($tocContent.length > 0 && $tocContent.html().trim().length > 0) {
          NexT.utils.displaySidebar();
        }
      }
    };
  });
</script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=0.5.0"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"rainboy"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
  





  
  
  
  <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
        processEscapes: true,
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
  </script>

  <script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for (i=0; i < all.length; i += 1) {
        all[i].SourceElement().parentNode.className += ' has-jax';
      }
    });
  </script>

  
    <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  

</body>
</html>
